import 'package:flutterdemo/models/entity/face_info_entity.dart';

faceInfoEntityFromJson(FaceInfoEntity data, Map<String, dynamic> json) {
	if (json['IsSuccess'] != null) {
		data.isSuccess = json['IsSuccess'];
	}
	if (json['Msg'] != null) {
		data.msg = json['Msg'].toString();
	}
	if (json['errmsg'] != null) {
		data.errmsg = json['errmsg'].toString();
	}
	if (json['errcode'] != null) {
		data.errcode = json['errcode'] is String
				? int.tryParse(json['errcode'])
				: json['errcode'].toInt();
	}
	if (json['Data'] != null) {
		data.data = new FaceInfoData().fromJson(json['Data']);
	}
	if (json['Status'] != null) {
		data.status = json['Status'] is String
				? int.tryParse(json['Status'])
				: json['Status'].toInt();
	}
	if (json['ExecuteMilliseconds'] != null) {
		data.executeMilliseconds = json['ExecuteMilliseconds'].toString();
	}
	return data;
}

Map<String, dynamic> faceInfoEntityToJson(FaceInfoEntity entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['IsSuccess'] = entity.isSuccess;
	data['Msg'] = entity.msg;
	data['errmsg'] = entity.errmsg;
	data['errcode'] = entity.errcode;
	if (entity.data != null) {
		data['Data'] = entity.data.toJson();
	}
	data['Status'] = entity.status;
	data['ExecuteMilliseconds'] = entity.executeMilliseconds;
	return data;
}

faceInfoDataFromJson(FaceInfoData data, Map<String, dynamic> json) {
	if (json['RecordCount'] != null) {
		data.recordCount = json['RecordCount'] is String
				? int.tryParse(json['RecordCount'])
				: json['RecordCount'].toInt();
	}
	if (json['PageCount'] != null) {
		data.pageCount = json['PageCount'] is String
				? int.tryParse(json['PageCount'])
				: json['PageCount'].toInt();
	}
	if (json['Records'] != null) {
		data.records = new List<FaceInfoDataRecord>();
		(json['Records'] as List).forEach((v) {
			data.records.add(new FaceInfoDataRecord().fromJson(v));
		});
	}
	return data;
}

Map<String, dynamic> faceInfoDataToJson(FaceInfoData entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['RecordCount'] = entity.recordCount;
	data['PageCount'] = entity.pageCount;
	if (entity.records != null) {
		data['Records'] =  entity.records.map((v) => v.toJson()).toList();
	}
	return data;
}

faceInfoDataRecordFromJson(FaceInfoDataRecord data, Map<String, dynamic> json) {
	if (json['Id'] != null) {
		data.id = json['Id'] is String
				? int.tryParse(json['Id'])
				: json['Id'].toInt();
	}
	if (json['AreaName'] != null) {
		data.areaName = json['AreaName'].toString();
	}
	if (json['OrgName'] != null) {
		data.orgName = json['OrgName'].toString();
	}
	if (json['CommunityId'] != null) {
		data.communityId = json['CommunityId'] is String
				? int.tryParse(json['CommunityId'])
				: json['CommunityId'].toInt();
	}
	if (json['CommunityName'] != null) {
		data.communityName = json['CommunityName'].toString();
	}
	if (json['BuildingId'] != null) {
		data.buildingId = json['BuildingId'] is String
				? int.tryParse(json['BuildingId'])
				: json['BuildingId'].toInt();
	}
	if (json['BuildingName'] != null) {
		data.buildingName = json['BuildingName'].toString();
	}
	if (json['UnitId'] != null) {
		data.unitId = json['UnitId'] is String
				? int.tryParse(json['UnitId'])
				: json['UnitId'].toInt();
	}
	if (json['UnitName'] != null) {
		data.unitName = json['UnitName'].toString();
	}
	if (json['Floor'] != null) {
		data.floor = json['Floor'].toString();
	}
	if (json['HouseId'] != null) {
		data.houseId = json['HouseId'] is String
				? int.tryParse(json['HouseId'])
				: json['HouseId'].toInt();
	}
	if (json['HouseName'] != null) {
		data.houseName = json['HouseName'].toString();
	}
	if (json['FaceName'] != null) {
		data.faceName = json['FaceName'].toString();
	}
	if (json['FaceUrl'] != null) {
		data.faceUrl = json['FaceUrl'].toString();
	}
	if (json['SoonSmartUserId'] != null) {
		data.soonSmartUserId = json['SoonSmartUserId'] is String
				? int.tryParse(json['SoonSmartUserId'])
				: json['SoonSmartUserId'].toInt();
	}
	if (json['JianYePlusUserId'] != null) {
		data.jianYePlusUserId = json['JianYePlusUserId'] is String
				? int.tryParse(json['JianYePlusUserId'])
				: json['JianYePlusUserId'].toInt();
	}
	if (json['Mobile'] != null) {
		data.mobile = json['Mobile'].toString();
	}
	if (json['Enabled'] != null) {
		data.enabled = json['Enabled'];
	}
	if (json['Dateandtime'] != null) {
		data.dateandtime = json['Dateandtime'].toString();
	}
	if (json['State'] != null) {
		data.state = json['State'] is String
				? int.tryParse(json['State'])
				: json['State'].toInt();
	}
	return data;
}

Map<String, dynamic> faceInfoDataRecordToJson(FaceInfoDataRecord entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['Id'] = entity.id;
	data['AreaName'] = entity.areaName;
	data['OrgName'] = entity.orgName;
	data['CommunityId'] = entity.communityId;
	data['CommunityName'] = entity.communityName;
	data['BuildingId'] = entity.buildingId;
	data['BuildingName'] = entity.buildingName;
	data['UnitId'] = entity.unitId;
	data['UnitName'] = entity.unitName;
	data['Floor'] = entity.floor;
	data['HouseId'] = entity.houseId;
	data['HouseName'] = entity.houseName;
	data['FaceName'] = entity.faceName;
	data['FaceUrl'] = entity.faceUrl;
	data['SoonSmartUserId'] = entity.soonSmartUserId;
	data['JianYePlusUserId'] = entity.jianYePlusUserId;
	data['Mobile'] = entity.mobile;
	data['Enabled'] = entity.enabled;
	data['Dateandtime'] = entity.dateandtime;
	data['State'] = entity.state;
	return data;
}